﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lançamento - Inaldo Imóveis</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/style-lancamento.css" rel="stylesheet" type="text/css" />
<link href="css/dd.css" rel="stylesheet" type="text/css" />
<link href="css/paginacao.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico"> <!--Icone para a aba do navegador-->

<script src="js/jquery-1-4-3-min.js" type="text/javascript"></script>
<script src="js/ie.js" type="text/javascript"></script>
<script src="js/cust_checkbox_plugin.js" type="text/javascript"></script>
<script src="js/jquery.dd.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function () {
	$('#menu ul li.imoveis').css("background", "url(images/index/detalhe-menu.png) no-repeat center left");
	
	try {
		$("#tipo-imovel").msDropDown({mainCSS:'dd2'});
		$("#bairro").msDropDown({mainCSS:'dd3'});
		
		$("#valor").msDropDown({mainCSS:'dd4'});		
	//alert($.msDropDown.version);
	//$.msDropDown.create("body select");		
	}catch(e) {
		alert("Error: "+e.message);
	}
	
	
	//Paginação
	function showLoader(){
		$('.search-background').fadeIn(200);
	}
	function hideLoader(){
		$('.search-background').fadeOut(200);
	};
	
	$("#paging_button li").click(function(){
		showLoader();
		
		$("#paging_button li").css({'background-color' : ''});
		$(this).css({'background-color' : '#D8543A'});

		$("#imovel").load("data_imovel-lancamento.php?page=" + this.id, hideLoader);
		
		return false;
	});
	
	$("#1").css({'background-color' : '#D8543A'});
	showLoader();
	$("#imovel").load("data_imovel-lancamento.php?page=1",  hideLoader);
		
});
</script>

</head>

<body>

<?php //Conexão com o banco de dados
include_once('admin/conexao/config.php');
$config = new Config();
$conexao = $config->conectar();

$per_page = 12;
$sql = "select * from imovel where lancamento = 1 order by id_imovel";
$rsd = $conexao->prepare($sql);
$rsd->execute();
$count = $rsd->rowCount(PDO::FETCH_ASSOC);
$pages = ceil($count/$per_page);


//Tipo Imóvel e endereço
$queryTipoImovel = "select id_tipo, nome_tipo from tipo_imovel where ativado_tipo = 1 order by nome_tipo;";

$tipo_imovel = $conexao->prepare($queryTipoImovel);				

$tipo_imovel->execute();

$queryEndereco = "SELECT DISTINCT(bairro) FROM endereco order by bairro;";
		
$endereco = $conexao->prepare($queryEndereco);						
		
$endereco->execute();


?>

<div id="geral">

  <div id="cabecalho">
	  <?php include("cabecalho.php"); ?>      
  </div> <!-- Fim div CABECALHO -->    
  
  <div id="conteudo">
   	<div id="tipo-negocio"></div><!--Fim div TIPO_NEGOCIO-->
        
        <div id="box-imoveis">			                               
        
        	<div id="box-imoveis-imoveis">
                        	
                <div class="search-background">
                    <label><img src="images/loader.gif" alt="" /></label>
                </div>
			                               
            	<div id="imovel"></div><!--Fim div IMOVEIS - aqui será carregando os imóveis-->
                
                
                <div id="paging_button" align="center">
                    <ul>
                    <?php
                    //Show page links
                    for($i=1; $i<=$pages; $i++)
                    {
                        echo '<li id="'.$i.'">'.$i.'</li>';
                    }?>
                    </ul>
                </div>   <!--Fim div PAGING_BUTTON-->             
                
            </div><!--Fim div BOX-IMOVEIS-IMOVEIS-->
        
        </div><!--Fim div BOX-IMOVEIS-->

  </div><!--Fim div CONTEUDO-->
</div><!-- Fim div GERAL -->

<div id="rodape">
	<div id="rodape-conteudo">
    	<?php include("rodape.php"); ?>
    </div><!--Fim div RODAPE-CONTEUDO-->
    
</div><!--Fim div RODAPE-->

</body>
</html>
